home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.04 Apr 91 / Assoc. Arrays / play games < prev    next >
Encoding:
Text File  |  1990-04-22  |  833 b   |  26 lines  |  [TEXT/MACV]

  1. "Select the following statements and execute 
  2.  with Do It to play Hexapawn against the 
  3.  computer (you play White)."
  4.  
  5. |p1 p2 board allPlayers|
  6. board := HexapawnGameBoard new.
  7. GameMonitor initialize: board.
  8. p1 := HexapawnHumanPlayer new: 'White' marker: 'W'.
  9. p2 := HexapawnComputerPlayer new: 'Black' marker: 'B'.
  10. allPlayers := Array new: 2.
  11. allPlayers at: 1 put: p1; at: 2 put: p2.
  12. board startPlay: allPlayers.
  13.  
  14. "Select the following statements and execute
  15.  with Do It to play Tic Tac Toe against the
  16.  computer (you play X, which moves first)."
  17.  
  18. |p1 p2 board allPlayers|
  19. board := TicTacToeGameBoard new.
  20. GameMonitor initialize: board.
  21. p1 := TicTacToeHumanPlayer new: 'X' marker: 'X'.
  22. p2 := TicTacToeComputerPlayer new: 'O' marker:'O'.
  23. allPlayers := Array new: 2.
  24. allPlayers at: 1 put: p1; at: 2 put: p2.
  25. board startPlay: allPlayers.
  26.